import { registerAs } from '@nestjs/config';
// DATABASE_USER=boycot2017
// DATABASE_PASSWORD=zch17184
// DATABASE_NAME=nest_blog
// DATABASE_PORT=3306
// DATABASE_HOST=47.113.87.100

// DATABASE_USER=root
// DATABASE_PASSWORD=root
// DATABASE_NAME=nest_blog
// DATABASE_PORT=3306
// DATABASE_HOST=localhost
const config = {
    "type": "mysql",
    "username": process.env.DATABASE_USER || "root", // boycot2017
    "password": process.env.DATABASE_PASSWORD || "zch17184",
    "database": process.env.DATABASE_NAME || "blog", // nest_blog
    "entities": ["dist/**/*.entity{.ts,.js}"],
    "charset": "utf8mb4", // 设置数据库编码格式为utf8mb4
    "collation": "utf8mb4_unicode_ci", // 设置数据库表编码格式为utf8mb4_unicode_ci
    "synchronize": true,
    host:process.env.DATABASE_HOST || "43.138.211.108", // 47.113.87.100
    port:process.env.DATABASE_PORT || 3306
}
export default registerAs('database', () => (config));